package com.socket.learing.transfer;

import lombok.extern.slf4j.Slf4j;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

@Slf4j
public class Service {

    public static void main(String[] args) {
        DatagramService datagramService = new DatagramService();
        CommonConstant.THREAD_POOL_EXECUTOR.execute(datagramService);
        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));) {
            String value = bufferedReader.readLine();
            log.info("输入：{}，程序退出",value);
        } catch (IOException e) {
            log.error("输入错误:{}",e);
        } finally {
            datagramService.close();
            CommonConstant.THREAD_POOL_EXECUTOR.shutdown();
        }
        log.info("服务器端退出");
    }

}